package com.my.demo;

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @description:
 * @author: marshal
 * @date: 2021-07-20 3:47 PM
 */
public class Test {
    public interface TestLib extends Library {
        TestLib INSTANCE = Native.load(("libtest.so"), TestLib.class);

        int add(int a, int b);

        Pointer sum(int a, int b);

        Pointer arr(int a, int b);

        String get_str(String str);
    }

    public static void main(String[] args) {
        System.out.println(TestLib.INSTANCE.add(10, 20));
        Pointer sum = TestLib.INSTANCE.sum(118, 3);
        System.out.println(sum.getInt(0));
//        Pointer arr = TestLib.INSTANCE.arr(20, 20);
//        System.out.println(arr.getInt(1));
        System.out.println(TestLib.INSTANCE.get_str("Tom"));
    }
}
